package com.scott.observer.core;

public class ConcreteObserver implements Observer {

    /**
     * 观察者状态
     */
    private String observerState;

    /**
     * 观察者名称
     */
    private String observerName;


    public ConcreteObserver(String name) {
        this.observerName = name;
    }


    @Override
    public void update(String state) {
        this.observerState = state;
        System.out.printf("%s 状态被更新为：%s\n", getName(), observerState);
    }

    public String getName() {
        return observerName;
    }

}
